//
// Created by Toosan on 2022/5/3.
//
#include <zconf.h>
#include "iostream"
#include "thread" // C++11自带的Thread，对pthread的封装 几乎不用这个
using namespace std;

void runAction(int number) {
    for (int i = 0; i < number; ++i) {
        cout << i << endl;
        sleep(1);
    }
}
/**
 * 线程学习 pthreads
 * @return
 */
int main() {
    // 打印5秒的内容
//    thread thread1(runAction,5);
    // main只等待3秒，3秒后main弹栈
//    sleep(3);
    thread thread2(runAction,5);
    // 等待thread2执行完后main再弹栈
    thread2.join();
    return 0;

}
